package com.handinglian.employee.mapper;

import com.handinglian.employee.dto.SystemUserInfoDto;
import com.handinglian.employee.dto.UserInfoDetailDto;
import com.handinglian.employee.dto.UserInfoDto;
import com.handinglian.employee.entity.UserInfo;
import com.handinglian.system.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

@Mapper
public interface UserInfoMapper {
    int deleteByPrimaryKey(Integer userId);

    int insert(UserInfo record);

    int insertOrUpdate(UserInfo record);

    int insertOrUpdateSelective(UserInfo record);

    int insertSelective(UserInfo record);

    UserInfo selectByPrimaryKey(Integer userId);

    int updateByPrimaryKeySelective(UserInfo record);

    int updateByPrimaryKey(UserInfo record);

    int updateBatch(List<UserInfo> list);

    int batchInsert(@Param("list") List<UserInfo> list);

    UserInfo findInvalidOneByJobNum(@Param("jobNum") String jobNum);

    List<UserInfoDto> inquireUserInfoPageList(@Param("nameOrJobNumOrPhone") String nameOrJobNumOrPhone, @Param("departmentName") String departmentName, @Param("sexList") List<Integer> sexList, @Param("permissionList") List<Integer> permissionList, @Param("departmentIds") List<Integer> departmentIds);

    List<UserInfo> findByPhonePermissionIn(@Param("phonePermissionCollection") Collection<Integer> phonePermissionCollection);

    List<SystemUserInfoDto> inquireSystemUserInfoPageList(@Param("departmentIds") List<Integer> departmentIds, @Param("nameOrJobNumOrPhone") String nameOrJobNumOrPhone, @Param("loginStateList") List<Integer> loginStateList);

    List<String> findJobNumByJobNumIn(@Param("jobNumCollection") Collection<String> jobNumCollection);

    List<Permission> inquirePermissionList(String jobNum);

    UserInfoDetailDto loadUserDetailByJobNum(@Param("jobNum") String jobNum);

    List<UserInfo> list(@Param("departmentId") Integer departmentId, @Param("nameOrPhone") String nameOrPhone);

    UserInfo findOneByJobNum(@Param("jobNum") String jobNum);

    List<UserInfo> findByJobNumIn(@Param("jobNumCollection") Collection<String> jobNumCollection);

    SystemUserInfoDto loadSystemUserInfo(@Param("userId") Integer userId);

    Integer count();

    Integer countByDataListIsNotNull();

    List<UserInfo> findByDepartmentIdIn(@Param("departmentIdCollection") Collection<Integer> departmentIdCollection);

    List<String> findPushIdByJobNum(@Param("jobNum")String jobNum);

    int updatePushIdByJobNum(@Param("updatedPushId")String updatedPushId,@Param("jobNum")String jobNum);

    UserInfo findOneByJobNumAndPushId(@Param("jobNum")String jobNum,@Param("pushId")String pushId);

    List<UserInfoDto> listUserInfoDto();

    List<String> findPushIdByPushIdIsNotNull();

    int updatePushIdByPushIdIn(@Param("pushIdCollection")Collection<String> pushIdCollection);
}